﻿using Newtonsoft.Json;

namespace Infrastructure.ExternalService.Core.Responses
{
    public class WrapResponse
    {
        [JsonProperty("api")]
        public string Api { get; set; }

        [JsonProperty("code")]
        public string Code { get; set; }

        [JsonProperty("msg")]
        public string Msg { get; set; }

        [JsonProperty("sid")]
        public string Sid { get; set; }

        [JsonProperty("cid")]
        public string Cid { get; set; }

        [JsonProperty("timestamp")]
        public string Timestamp { get; set; }

        /// <summary>
        /// 自定义字段（请求是否成功，返回code是否是成功码）
        /// </summary>
        public bool Success => ClientReturnCode.Success.Equals(Code) || "0000".Equals(Code) || "000000".Equals(Code);
    }
    public class WrapResponse<T> : WrapResponse
    {
        [JsonProperty("data")]
        public T Data { get; set; }
    }
}
